﻿using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using WoChu.RfClient.Entity;
using WoChu.RfClient.Duty.IFace;

namespace WoChu.RfClient.Duty
{
    public class BarCodeCollectionUIRule
    {
        private static BarCodeCollectionUIRule _NewInstance = new BarCodeCollectionUIRule();

        public static BarCodeCollectionUIRule NewInstance
        {
            get
            {
                if (_NewInstance == null)
                {
                    _NewInstance = new BarCodeCollectionUIRule();
                }

                return _NewInstance;
            }
        }
        public ResultModel<GoodsAllInfo> GetGoodsInfoNeedCollection(string goodsCode)
        {
            try
            {
                var _result = WoChu.CF.BaseFrame.WebClient.WebGetHelper<IBarCodeCollection>.NewInstance.InvokeWebMethod<ResultModel<GoodsAllInfo>>("GetGoodsInfoNeedCollection", new object[] { goodsCode });

                if (_result == null)
                    return new ResultModel<GoodsAllInfo>().GetInstance();
                return _result;

            }
            catch (Exception ex)
            {
                WoChu.CF.BaseFrame.Util.MessageBoxEx.Show(ex);
                return new ResultModel<GoodsAllInfo>().GetInstance();
            }

        }
        public ResultModel<bool> UpdateGoodsBarCode(List<GoodsAllInfo> lstGoods)
        {
            try
            {
                var _result = WoChu.CF.BaseFrame.WebClient.WebGetHelper<IBarCodeCollection>.NewInstance.InvokeWebMethod<List<GoodsAllInfo>, ResultModel<bool>>("UpdateGoodsBarCode", new object[] { }, lstGoods);

                if (_result == null)
                    return new ResultModel<bool>().GetInstance();
                return _result;
            }
            catch (Exception ex)
            {
                WoChu.CF.BaseFrame.Util.MessageBoxEx.Show(ex);
                return new ResultModel<bool>().GetInstance();
            }

        }

    }
}
